import {Component, OnInit} from '@angular/core';

import {HttpClient, HttpParams} from '@angular/common/http';

import {Observer} from 'rxjs';
import {tap} from 'rxjs/operators';

import {ListService} from './app.service';
import {SelectedService} from './selected.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
  list: {};

  constructor(private listService: ListService,
              public selectedService: SelectedService) {
  }

  ngOnInit(): void {
    this.getListServe();
  }

  setSelected(payload): void {
    this.selectedService.selected(
      payload.type,
      payload.multi,
      payload.data
    );
  }

  getListServe(): void {
    this.listService.getList().subscribe(data => {
      this.list = data['data']['bedroom'];
    });
    this.listService.test1().next('在外部产生新事件');
  }
}
